package com.zondy.mapgis.psmap.manager.constant;

import java.util.Arrays;

public enum DataServiceType {
   UNKNOWN("未知", "unknown"),
   IGSIMAGE("MapGIS 矢量地图服务", "server"),
   IGSTILED("MapGIS 瓦片地图服务", "server"),
   IGSVECTOR("MapGIS 图层地图服务", "server"),
   VTTILES("MapGIS 矢量瓦片服务", "server"),
   IGSPanoramic("IGSPanoramic 服务", "server"),
   DataFlow("MapGIS 数据流服务", "server"),
   IMAGEARCGIS("ArcGIS 地图服务", "server"),
   TILEARCGIS("ArcGIS 瓦片服务", "server"),
   WMS("OGC WMS 服务", "server"),
   WMTS("OGC WMTS 服务", "server"),
   IGSScene("MapGIS 场景服务", "globe"),
   TILE3D("3DTiles服务", "globe"),
   ModelCache("MapGIS M3D模型缓存服务", "globe"),
   STKTerrain("STK地形", "globe"),
   NOSPATIALDATA("非空间数据", "data");

   private final String name;
   private final String category;

   private DataServiceType(String name, String category) {
      this.name = name;
      this.category = category;
   }

   public static DataServiceType fromString(String name) {
      return (DataServiceType)Arrays.stream(values()).filter((t) -> {
         return t.toString().equalsIgnoreCase(name);
      }).findFirst().orElse(UNKNOWN);
   }

   public static DataServiceType fromName(String code) {
      return (DataServiceType)Arrays.stream(values()).filter((t) -> {
         return t.getName().equalsIgnoreCase(code);
      }).findFirst().orElse(UNKNOWN);
   }

   public String getName() {
      return this.name;
   }

   public String getCategory() {
      return this.category;
   }
}
